<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    use HasFactory;
    protected $table = 'order';
    protected $guarded = [];

    public function goods(){
        return $this->belongsTo(Goods::class,'id','goods_id');
    }

    public function user()
    {
        return $this->hasOne(User::class,'id','user_id');
    }

    public function getGoodsCoveAttribute($value)
    {
        return getDomain().'/uploads/'.$value;
    }

    public function wx_pay_recoed(){
        //return $this->hasMany()
    }
}
